import {getCalendar} from "@/api/calc/otcOption/calc";

const useCalendarStore = defineStore(
    'calendar',
    {
        state: ()=>(
            {
                tcalendarDates:[],
                tcalendarAllDates:[]
            }
        ),
        actions: {
            GetCalendars() {
                var Calendars = {};

                getCalendar({tempxx:''}).then(response => {
                        if (response.code != 0) {
                        } else {
                            Calendars.dates= response.result.filter(item => item.CAL_FLAG=='1'||item.CAL_FLAG==1)
                            Calendars.datesArr = Calendars.dates.map(item => item.CAL_DAY)
                            this.tcalendarDates = Calendars.datesArr
                            this.tcalendarAllDates=response.result;
                        }
                    }
                )
            }
        }
    }
)


export default useCalendarStore;
